﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;


namespace Address_Book
{
    public partial class frmLogin : Form
    {
        public frmLogin()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            string UserName = txtUserName.Text.Trim();
            string PassWord = txtPassWord.Text;
            Address_Book.BLL.LoginManager mgr = new Address_Book.BLL.LoginManager();
            try
            {
                bool loginflag = mgr.Login(UserName, PassWord);
                if (loginflag)
                {
                    this.DialogResult = DialogResult.OK;//些时登陆成功，返回父窗体 DialogResult.OK，构造主窗体frmMain
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            txtUserName.Text = "";
            txtPassWord.Text = "";
        }
    }
}